/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "BrewLabDetails")
@XmlRootElement
public class BrewLabDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "BrewLabDetailsID")
    private Integer bldid;
    @Size(min = 0, max = 250)
    @Column(name = "BrewLabDetailsDesc")
    private String blddesc;
    @JoinColumn(name = "BrewLabTypeID", referencedColumnName = "labTypeID", nullable=true)
    @ManyToOne(optional = true)
    private LabType labType;
    @Basic(optional = false)
    @NotNull
    @Column(name = "BrewLabDetailsResult")
    private int bldResult;
    @Size(min = 0, max = 500)
    @Column(name = "BrewLabDetailsNotes")
    private String bldNotes;
    @Basic(optional = false)
    @NotNull
    @Column(name = "BrewLabDetailsDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;

    public BrewLabDetails() {
    }

    public BrewLabDetails(Integer bldid) {
        this.bldid = bldid;
    }

    public BrewLabDetails(Integer bldid, String blddesc, int bldResult, String bldNotes) {
        this.bldid = bldid;
        this.blddesc = blddesc;
        this.bldResult = bldResult;
        this.bldNotes = bldNotes;
    }

    public Integer getBldid() {
        return bldid;
    }

    public void setBldid(Integer bldid) {
        this.bldid = bldid;
    }

    public String getBlddesc() {
        return blddesc;
    }

    public void setBlddesc(String blddesc) {
        this.blddesc = blddesc;
    }

    public LabType getLabType() {
        return labType;
    }

    public void setLabType(LabType labType) {
        this.labType = labType;
    }

    public int getBldResult() {
        return bldResult;
    }

    public void setBldResult(int bldResult) {
        this.bldResult = bldResult;
    }

    public String getBldNotes() {
        return bldNotes;
    }

    public void setBldNotes(String bldNotes) {
        this.bldNotes = bldNotes;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bldid != null ? bldid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BrewLabDetails)) {
            return false;
        }
        BrewLabDetails other = (BrewLabDetails) object;
        if ((this.bldid == null && other.bldid != null) || (this.bldid != null && !this.bldid.equals(other.bldid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.BrewLabDetails[ bldid=" + bldid + " ]";
    }
    
}
